package com.springboot.husha.controller.app;


import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.springboot.husha.entity.Sheyingjidi;
import com.springboot.husha.entity.Zhenshikezhao;
import com.springboot.husha.qpage.QPage;
import com.springboot.husha.service.ISheyingjidiService;
import com.springboot.husha.util.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author author
 * @since 2024-02-28
 */
@Controller
@RequestMapping("/api/front/sheyingjidi")
public class AppSheyingjidiController {


    /**
     * 路由地址
     */
    public String prefix = "/view/front/sheyingjidi";

    /**
     * 业务层
     */
    @Autowired
    private ISheyingjidiService service;

    /**
     * 进入管理页面
     * @return
     */
    @RequestMapping("/index")
    public String index(){
        return prefix+"/index";
    }

    /**
     * 获取所有的列表
     * @return
     */
    @RequestMapping("/list")
    @ResponseBody
    public Result getList(Integer num, Sheyingjidi obj) {
        QueryWrapper<Sheyingjidi> queryWrapper=new QueryWrapper<>();
        if(num!=null&&num>0){
            queryWrapper.last(" limit "+num);
        }
        List<Sheyingjidi> sheyingjidiList=this.service.list(queryWrapper);
        return Result.reOk("查询成功",sheyingjidiList);
    }


}
